<!--
 * @Author: your name
 * @Date: 2021-09-05 09:37:07
 * @LastEditTime: 2021-09-05 11:13:53
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \shangjia\userIndex.html
-->
<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <title>抱团员工端</title>
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no,minimal-ui,viewport-fit=cover"/>
    <meta name="keywords" content="抱团">
    <meta name="description" content="抱团">
    <script type='text/javascript' src="../common/js/base.js" charset="UTF-8"></script>
    <link rel="stylesheet" type="text/css" href="../common/css/theme-chalk/index.css">
    <link rel="stylesheet" type="text/css" href="../common/css/animate.min.css">
    <link rel="stylesheet" type="text/css" href="../common/css/nanoscroller.css">
    <link rel="stylesheet" type="text/css" href="../common/css/swiper-bundle.min.css">
    <link rel="stylesheet" type="text/css" href="../common/css/base.css">
    <link rel="stylesheet" type="text/css" href="css/style_mobile.css">
    <script type='text/javascript' src="../common/js/jquery.min.js" charset="UTF-8"></script>
    <script type='text/javascript' src="../common/js/jquery.easing.js" charset="UTF-8"></script>
    <script type='text/javascript' src="../common/js/html2canvas.min.js" charset="UTF-8"></script>
    <script type="text/javascript" src="../common/js/layer/layer.js" charset="UTF-8"></script>
    <script type="text/javascript" src="../common/js/wow.js" charset="UTF-8"></script>
    <script type="text/javascript" src="../common/js/vue.js" charset="UTF-8"></script>
    <script type="text/javascript" src="../common/js/vue-resource.js" charset="UTF-8"></script>
    <script type="text/javascript" src="../common/js/axios.min.js" charset="UTF-8"></script>
    <script type='text/javascript' src="../common/js/elementui.min.js" charset="UTF-8"></script>
    <script type='text/javascript' src="../common/js/jquery.nanoscroller.js" charset="UTF-8"></script>
    <script type='text/javascript' src="../common/js/swiper.animate.min.js" charset="UTF-8"></script>
    <script type='text/javascript' src="../common/js/swiper-bundle.min.js" charset="UTF-8"></script>
    <script type='text/javascript' src="../common/js/helper.js" charset="UTF-8"></script>
</head>
<body>
<div class="page user hasmenu" id="app">
    <div class="user-msg">
        <div class="t">
            <div class="l">
                <div class="avatar" :style="{backgroundImage:'url(' + wx_user.avatar_url + ')'}"></div>
                <div class="name">{{employee.name || '未登录'}}</div>
            </div>
            <div class="r">
                <div class="resultPass" v-on:click="reset">重设密码</div>
                <div class="login-out" v-on:click="logout">退出</div>
            </div>
        </div>
    </div>
    <div class="mainBox" v-if="summary">
        <div class="thisDay section">
            <div class="t">
                <div class="l">我的收益</div>
                <div class="r" v-on:click="profit">查看</div>
            </div>
            <div class="list">
                <div class="item">
                    <div class="block">
                        <div>总收益：</div>
                        <div>{{summary.profit.total}}</div>
                    </div>
                    <div class="block block_">
                        <div>暂存收益：</div>
                        <div>{{summary.profit.temp}}</div>
                    </div>
                </div>
                <div class="item">
                    <div class="block">
                        <div>已结算收益：</div>
                        <div>{{summary.profit.settled}}</div>
                    </div>
                    <div class="block block_">
                        <div>本月可结算收益：</div>
                        <div>{{summary.profit.confirmed}}</div>
                    </div>
                </div>

            </div>
        </div>
        <div class="myhd section">
            <div class="t">
                <div class="l">我的商家与活动</div>
                <div class="r" v-on:click="activity">查看</div>
            </div>
            <div class="list">
                <div class="item">
                    <span>未活动商家：</span>
                    <span>{{summary.merchants.in_active}}</span>
                </div>
                <div class="item">
                    <span>活动商家：</span>
                    <span>{{summary.merchants.active}}</span>
                </div>
            </div>
        </div>
        <div class="myhd section">
            <div class="t">
                <div class="l">我的订单</div>
            </div>
            <div class="list">
                <div class="item">
                    <span>我的订单总数：</span>
                    <span>{{summary.order.total}}</span>
                </div>
                <div class="item">
                    <span>本月订单总数：</span>
                    <span>{{summary.order.month}}</span>
                </div>
            </div>
        </div>


    </div>
<!--    <a class="indexbtn" href="./pc_add_active.html"><img src="images/index-btn.png"></a>-->
</div>

<div class="indexbotmenu">
    <a href="./userIndex.html" class="item">
        <div class="img"><img src="images/index-botmenu-ico1-select.png" alt=""></div>
        <p>首页</p>
    </a>
    <a href="./profits.html" class="item">
        <div class="img"><img src="images/index-botmenu-ico2.png" alt=""></div>
        <p>收益</p>
    </a>
<!--    <a href="./pc_add_active.html" class="item">-->
<!--        <div class="img"><img src="images/index-botmenu-ico3.png" alt=""></div>-->
<!--        <p>添加活动</p>-->
<!--    </a>-->
    <a href="./activity.html" class="item">
        <div class="img"><img src="images/index-botmenu-ico4.png" alt=""></div>
        <p>商家</p>
    </a>
</div>

</body>
<script>
  $(function () {
    new Vue({
      el: '#app',
      data() {
        return {
          wx_user: {},
          employee: {},
          summary: undefined,
        }
      },
      mounted() {
      },
      created() {
        this.wx_user = JSON.parse(getCookie('wx_user')) || {}
        if (!this.wx_user.id) {
          window.location.href = '/employee';
          return;
        }
        this.init()
      },
      methods: {
        init: function () {
          this.employee = JSON.parse(localStorage.getItem('employee'))
          employee_get('summary').then(res => {
            this.summary = res
          })
        },
        logout: function () {
          localStorage.removeItem('employee_token')
          localStorage.removeItem('employee')
          window.location.href = 'index.html'
        },
        reset: function () {
          window.location.href = 'reset.html'
        },
        profit: function () {
          window.location.href = "profits.html"
        },
        activity: function () {
          window.location.href = "activity.html"
        },
      }
    });
  })
</script>
</html>
